<template>
  <view class="module-container">
    <view class="module-header">
      <text class="module-title">模块3</text>
      <text class="module-subtitle">游戏中心</text>
    </view>
    
    <view class="module-content">
      <view class="content-card">
        <image src="/static/icons/module3.svg" class="card-image" mode="aspectFit"></image>
        <text class="card-title">游戏中心</text>
        <text class="card-desc">欢迎来到游戏中心，这里有各种有趣的小游戏等你来体验！</text>
      </view>
      
      <view class="games-list">
        <!-- 打飞机游戏 -->
        <view class="game-item" @click="startPlaneGame">
          <view class="game-icon">
            <image src="/static/icons/plane.svg" mode="aspectFit"></image>
          </view>
          <view class="game-info">
            <text class="game-title">太空打飞机</text>
            <text class="game-desc">驾驶战机消灭来袭的敌机，挑战高分！</text>
          </view>
          <view class="start-icon">
            <text>▶</text>
          </view>
        </view>
        
        <!-- 其他游戏占位 -->
        <view class="game-item" v-for="index in 3" :key="index">
          <view class="game-icon">
            <image src="/static/icons/module3.svg" mode="aspectFit"></image>
          </view>
          <view class="game-info">
            <text class="game-title">游戏 {{index + 1}}</text>
            <text class="game-desc">开发中，敬请期待...</text>
          </view>
          <view class="coming-soon-icon">
            <text>⏳</text>
          </view>
        </view>
      </view>
    </view>
    
    <!-- 打飞机游戏组件 -->
    <PlaneGame :isVisible="showPlaneGame" @close="closePlaneGame" />
  </view>
</template>

<script>
import PlaneGame from '@/components/PlaneGame.vue'

export default {
  components: {
    PlaneGame
  },
  data() {
    return {
      showPlaneGame: false
    }
  },
  onLoad() {
    // 页面加载时的逻辑
  },
  methods: {
    startPlaneGame() {
      // 启动打飞机游戏
      this.showPlaneGame = true
    },
    closePlaneGame() {
      // 关闭打飞机游戏
      this.showPlaneGame = false
    }
  }
}
</script>

<style scoped>
.module-container {
  padding: 20rpx;
  background: #f8f8f8;
  min-height: 100vh;
}

.module-header {
  padding: 60rpx 20rpx 40rpx;
  text-align: center;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 20rpx 20rpx 0 0;
  color: #fff;
}

.module-title {
  font-size: 48rpx;
  font-weight: bold;
  margin-bottom: 10rpx;
  display: block;
}

.module-subtitle {
  font-size: 28rpx;
  opacity: 0.9;
}

.module-content {
  background: #fff;
  border-radius: 0 0 20rpx 20rpx;
  padding: 40rpx 20rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}

.content-card {
  text-align: center;
  margin-bottom: 60rpx;
}

.card-image {
  width: 160rpx;
  height: 160rpx;
  margin: 0 auto 30rpx;
}

.card-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 20rpx;
  display: block;
}

.card-desc {
  font-size: 28rpx;
  color: #666;
  line-height: 40rpx;
  margin-bottom: 30rpx;
  display: block;
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 30rpx;
}

.game-item {
  display: flex;
  align-items: center;
  padding: 30rpx;
  background: #f8f8f8;
  border-radius: 16rpx;
  transition: all 0.3s ease;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}

.game-item:active {
  background: #e8e8e8;
  transform: scale(0.98);
}

.game-icon {
  width: 100rpx;
  height: 100rpx;
  background: #fff;
  border-radius: 16rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 30rpx;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}

.game-icon image {
  width: 70rpx;
  height: 70rpx;
}

.game-info {
  flex: 1;
}

.game-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 10rpx;
  display: block;
}

.game-desc {
  font-size: 28rpx;
  color: #666;
  line-height: 40rpx;
}

.start-icon,
.coming-soon-icon {
  width: 80rpx;
  height: 80rpx;
  border-radius: 50%;
  background: #fff;
  color: #667eea;
  font-size: 36rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}

.coming-soon-icon {
  color: #999;
}
</style>